package src.resource;

import java.util.HashSet;
import java.util.Set;
import javax.swing.DefaultListModel;

import src.domain.PostOffice;

public class CommonMethods {
	
	public static DefaultListModel toListModel(Set<?> set){
		DefaultListModel l=new DefaultListModel();
		if(set==null)
			return l;
		for(Object u:set)
			l.addElement(u);
		return l;
	}
	
	public static Set<PostOffice> toSet(DefaultListModel l){
		Set<PostOffice> s=new HashSet<PostOffice>();
		for(Object o:l.toArray())
			s.add((PostOffice)o);
		return s;	
	}

}
